//
//  WarnDetailResultTableViewCell.m
//  Rail
//
//  Created by hychen on 2018/2/28.
//  Copyright © 2018年 Hychen. All rights reserved.
//

#import "WarnDetailResultTableViewCell.h"

@interface WarnDetailResultTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *resultLabel;
@property (weak, nonatomic) IBOutlet UIImageView *bubbleImage;
@property (weak, nonatomic) IBOutlet UIImageView *avatarImage;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end

@implementation WarnDetailResultTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentLabel.preferredMaxLayoutWidth = SCREEN_WIDTH-120;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.avatarImage.layer.cornerRadius = 22.5f;
    self.avatarImage.layer.masksToBounds = YES;
    UIImage *image = [UIImage imageNamed:@"information_warn_idea_area_img"];
    CGFloat resizeW = image.size.width * 0.5;
    CGFloat resizeH = image.size.height * 0.5;
    UIImage *rezibleImage = [image resizableImageWithCapInsets:UIEdgeInsetsMake(resizeH, resizeW, resizeW, resizeH) resizingMode:UIImageResizingModeStretch];
    self.bubbleImage.image = rezibleImage;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(WarnDetailModel *)model {
    _model = model;
    self.resultLabel.text = [model.process_result boolValue]?@"已处理":@"未处理";
    [self.avatarImage sd_setImageWithURL:[NSURL URLWithString:model.logo_url] placeholderImage:ImageNamed_bb(@"app_user_default_portrait_ic")];
    self.nameLabel.text = model.username;
    self.contentLabel.text = model.suggestion?:@"";
    self.timeLabel.text = [BMUtils chineseYYYYMMDDHHmmWithServiceTime:model.process_time];
}
@end
